package com.ape.mapsa.converters;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import org.apache.log4j.Logger;

import com.ape.mapsa.produccion.model.Color;

@FacesConverter(value = "ColorConverter")
public class ColorConverter implements Converter {
	private static final Logger logger = Logger.getLogger(ColorConverter.class);

	@Override
	public Object getAsObject(FacesContext context, UIComponent component, String value) {
		logger.debug("converting color getting object");
		Color color = new Color();
		color.setNombre(value);
		return color;
	}

	@Override
	public String getAsString(FacesContext context, UIComponent component, Object value) {
		logger.debug("converting color getting string");
		return value.toString();
	}

}
